import { Component } from 'react'
import Taro from '@tarojs/taro'
import { View,Image,Text,Block } from '@tarojs/components'
import {Stepper,ActionSheet,Row, Col,Button } from '@antmjs/vantui'
import { connect } from 'react-redux'
import { AddShoppingAction,DecreaseShoppingAction,SetShoppingAction} from '../../../redux/action/shoppingAction';
// import { ChangeLoadingAction } from '../../redux/action/loadingAction';
// import Loading from '../../components/Loading/index'
import dev from '../../../../config/dev'
import './index.less'

const isH5 = process.env.TARO_ENV === 'h5'

@connect(	state => ({
    shoppingCart:state.shoppingCart
	}),
	{AddShoppingAction,DecreaseShoppingAction,SetShoppingAction}
)
class List extends Component {
  state={
  }

  // UNSAFE_componentWillMount () { console.log('UNSAFE_componentWillMount,组件还没挂载前');if(isH5){console.log('你当前环境为H5')} }

  // componentDidMount () { console.log('componentDidMount,组件挂载后');console.log(this.props.obj.norms.name)}

  // shouldComponentUpdate (nextProps,nextState) { console.log('shouldComponentUpdate,组件是否需要更新',nextProps,nextState);return true }

  // componentWillUnmount () { console.log('componentWillUnmount,组件卸载前') }

  // componentDidShow () { console.log('componentDidShow,组件显示后') }

  // componentDidHide () { console.log('componentDidHide,组件隐藏后') }

  render () {
    return (
      <Block>
        <View className='list-variety'>
          <View className='avatar-box'><Image className='img' src={dev.baseUrl+this.props.obj.img}></Image></View>
          <View className='list-content'>
            <View className='content-title'>{this.props.obj.name}{this.props.obj.norms?"("+this.props.obj.norms.name+")":''}</View>
            <View className='variety-config'>x{this.props.obj.num}</View>
          </View>
          <View className='list-footer'>
            ￥{this.props.obj.price*this.props.obj.num}
          </View>
        </View>
      </Block>
    )
  }
}
List.defaultProps = {}
export default List

